Prep data

Load necessary packages

Define aesthetics

palette_map = c("#3B9AB2", "#EBCC2A", "#F21A00")
palette_condition = c("#ee9b00", "#bb3e03", "#005f73")

plot_aes = theme_minimal() +
  theme(legend.position = "top",
        legend.text = element_text(size = 12),
        text = element_text(size = 16, family = "Futura Medium"),
        axis.text = element_text(color = "black"),
        axis.line = element_line(colour = "black"),
        axis.ticks.y = element_blank())

Load data

data <- read_csv("disaggregated_data.csv")
data$timepoint_num <- as.factor(data$timepoint_num) #set as a factor so our graphs can work 

Tidy data

Data transformations

  • None

Exclusions

  • No participants were excluded

Sample size

sample <- data %>%
  select(timepoint, SID) %>%
  unique() %>%
  group_by(timepoint) %>%
  dplyr::summarize(n = n()) %>%
  reactable::reactable(striped = TRUE)
sample

Data quality checks

Missing data

data %>%
  filter(is.na(progress)) %>%
  group_by(SID,timepoint) %>%
  dplyr::summarize(n = n()) %>%
  arrange(-n)

Outliers

There do not appear to be obvious outliers

progress <- data %>%
  ggplot(aes(timepoint, progress, fill = timepoint)) +
  geom_flat_violin(position = position_nudge(x = .1, y = 0), color = FALSE) +
  geom_point(aes(color = timepoint), position = position_jitter(width = .05), size = .1, alpha = .1) + 
  geom_boxplot(width = .1, outlier.shape = NA, fill = NA) +
  scale_fill_manual(values = wesanderson::wes_palette("Zissou1", n = 4, type = "continuous")) +
  scale_color_manual(values = wesanderson::wes_palette("Zissou1", n = 4, type = "continuous")) +
  labs(x = "") +
  coord_flip() +
  plot_aes +
  theme(legend.position = "none")

autonomous_motivation_within <- data %>%
  ggplot(aes(timepoint, autonomous_motivation_within, fill = timepoint)) +
  geom_flat_violin(position = position_nudge(x = .1, y = 0), color = FALSE) +
  geom_point(aes(color = timepoint), position = position_jitter(width = .05), size = .1, alpha = .1) + 
  geom_boxplot(width = .1, outlier.shape = NA, fill = NA) +
  scale_fill_manual(values = wesanderson::wes_palette("Zissou1", n = 4, type = "continuous")) +
  scale_color_manual(values = wesanderson::wes_palette("Zissou1", n = 4, type = "continuous")) +
  labs(x = "") +
  coord_flip() +
  plot_aes +
  theme(legend.position = "none")

controlled_motivation_within  <- data %>%
  ggplot(aes(timepoint, controlled_motivation_within, fill = timepoint)) +
  geom_flat_violin(position = position_nudge(x = .1, y = 0), color = FALSE) +
  geom_point(aes(color = timepoint), position = position_jitter(width = .05), size = .1, alpha = .1) + 
  geom_boxplot(width = .1, outlier.shape = NA, fill = NA) +
  scale_fill_manual(values = wesanderson::wes_palette("Zissou1", n = 4, type = "continuous")) +
  scale_color_manual(values = wesanderson::wes_palette("Zissou1", n = 4, type = "continuous")) +
  labs(x = "") +
  coord_flip() +
  plot_aes +
  theme(legend.position = "none")

autonomous_motivation_between <- data %>%
  ggplot(aes(timepoint, autonomous_motivation_between, fill = timepoint)) +
  geom_flat_violin(position = position_nudge(x = .1, y = 0), color = FALSE) +
  geom_point(aes(color = timepoint), position = position_jitter(width = .05), size = .1, alpha = .1) + 
  geom_boxplot(width = .1, outlier.shape = NA, fill = NA) +
  scale_fill_manual(values = wesanderson::wes_palette("Zissou1", n = 4, type = "continuous")) +
  scale_color_manual(values = wesanderson::wes_palette("Zissou1", n = 4, type = "continuous")) +
  labs(x = "") +
  coord_flip() +
  plot_aes +
  theme(legend.position = "none")

controlled_motivation_between <- data %>%
  ggplot(aes(timepoint, controlled_motivation_between, fill = timepoint)) +
  geom_flat_violin(position = position_nudge(x = .1, y = 0), color = FALSE) +
  geom_point(aes(color = timepoint), position = position_jitter(width = .05), size = .1, alpha = .1) + 
  geom_boxplot(width = .1, outlier.shape = NA, fill = NA) +
  scale_fill_manual(values = wesanderson::wes_palette("Zissou1", n = 4, type = "continuous")) +
  scale_color_manual(values = wesanderson::wes_palette("Zissou1", n = 4, type = "continuous")) +
  labs(x = "") +
  coord_flip() +
  plot_aes +
  theme(legend.position = "none")

descriptive_graphs <- ggpubr::ggarrange(progress,autonomous_motivation_within,controlled_motivation_within,
                                        autonomous_motivation_between,controlled_motivation_between ,ncol=2, nrow=3, common.legend = T, legend = "bottom")
descriptive_graphs

Descriptive statistics

Goal Progress (Rating scale: 0-100%)

What percentage of this project is completed right now?

Motivation Rating (1 = not at all for this reason, 7 = completely for this reason)

Please rate the extent to which you are working on this personal project because:

It provides you fun and enjoyment

You really believe it’s an important goal to have

You would feel ashamed, guilty, or anxious if you didn’t

Somebody else wants you to or because the situation demands it

Items 1 and 2 will be averaged to create an index of autonomous motivation; items 3 and 4 will be averaged to create an index of controlled motivation.

#means
means = data %>%
  group_by(timepoint_num) %>%
  filter(!is.na(progress)) %>%
  summarize(N = n(),
            `M (SD)` = sprintf("%s (%s)", round(mean(progress, na.rm = TRUE), 2), round(sd(progress, na.rm = TRUE), 2))) %>%
  mutate(`scale range` = "0-100") %>%
  select(`scale range`, everything()) %>%
  rename("timepoint" = timepoint_num)
means

Preregistered analyses

The following hypotheses are preregistered. The preregistration is available on OSF

Primary Analyses

We estimated a single model to test H1 and H2 using noninformatie priors (mu = 0, sigma = 5).

Hypothesis 1

H1 Between-person: People who tend to have more autonomous goals compared to others will show greater goal progress

Results

❌ These data are not consistent with the hypothesis that people who tend to have more autonomous goals compared to others will show greater goal progress as zero was included in the 95% Credible Interval.

Look at our model

mod_h1 #check out our model
##  Family: gaussian 
##   Links: mu = identity; sigma = identity 
## Formula: progress ~ timepoint_num + autonomous_motivation_between + autonomous_motivation_between * timepoint_num + autonomous_motivation_within + autonomous_motivation_within * timepoint_num + (1 + autonomous_motivation_within * timepoint_num | SID) 
##    Data: data (Number of observations: 2076) 
##   Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
##          total post-warmup draws = 4000
## 
## Group-Level Effects: 
## ~SID (Number of levels: 182) 
##                                                                               Estimate
## sd(Intercept)                                                                    17.62
## sd(autonomous_motivation_within)                                                  4.89
## sd(timepoint_num1)                                                               14.68
## sd(autonomous_motivation_within:timepoint_num1)                                   1.25
## cor(Intercept,autonomous_motivation_within)                                       0.37
## cor(Intercept,timepoint_num1)                                                    -0.82
## cor(autonomous_motivation_within,timepoint_num1)                                 -0.30
## cor(Intercept,autonomous_motivation_within:timepoint_num1)                        0.07
## cor(autonomous_motivation_within,autonomous_motivation_within:timepoint_num1)    -0.00
## cor(timepoint_num1,autonomous_motivation_within:timepoint_num1)                  -0.06
##                                                                               Est.Error
## sd(Intercept)                                                                      1.20
## sd(autonomous_motivation_within)                                                   0.89
## sd(timepoint_num1)                                                                 1.40
## sd(autonomous_motivation_within:timepoint_num1)                                    0.94
## cor(Intercept,autonomous_motivation_within)                                        0.15
## cor(Intercept,timepoint_num1)                                                      0.04
## cor(autonomous_motivation_within,timepoint_num1)                                   0.18
## cor(Intercept,autonomous_motivation_within:timepoint_num1)                         0.42
## cor(autonomous_motivation_within,autonomous_motivation_within:timepoint_num1)      0.43
## cor(timepoint_num1,autonomous_motivation_within:timepoint_num1)                    0.42
##                                                                               l-95% CI
## sd(Intercept)                                                                    15.41
## sd(autonomous_motivation_within)                                                  3.02
## sd(timepoint_num1)                                                               11.96
## sd(autonomous_motivation_within:timepoint_num1)                                   0.05
## cor(Intercept,autonomous_motivation_within)                                       0.09
## cor(Intercept,timepoint_num1)                                                    -0.90
## cor(autonomous_motivation_within,timepoint_num1)                                 -0.64
## cor(Intercept,autonomous_motivation_within:timepoint_num1)                       -0.74
## cor(autonomous_motivation_within,autonomous_motivation_within:timepoint_num1)    -0.80
## cor(timepoint_num1,autonomous_motivation_within:timepoint_num1)                  -0.82
##                                                                               u-95% CI
## sd(Intercept)                                                                    20.09
## sd(autonomous_motivation_within)                                                  6.59
## sd(timepoint_num1)                                                               17.46
## sd(autonomous_motivation_within:timepoint_num1)                                   3.48
## cor(Intercept,autonomous_motivation_within)                                       0.66
## cor(Intercept,timepoint_num1)                                                    -0.72
## cor(autonomous_motivation_within,timepoint_num1)                                  0.03
## cor(Intercept,autonomous_motivation_within:timepoint_num1)                        0.81
## cor(autonomous_motivation_within,autonomous_motivation_within:timepoint_num1)     0.80
## cor(timepoint_num1,autonomous_motivation_within:timepoint_num1)                   0.75
##                                                                               Rhat
## sd(Intercept)                                                                 1.00
## sd(autonomous_motivation_within)                                              1.00
## sd(timepoint_num1)                                                            1.00
## sd(autonomous_motivation_within:timepoint_num1)                               1.00
## cor(Intercept,autonomous_motivation_within)                                   1.00
## cor(Intercept,timepoint_num1)                                                 1.00
## cor(autonomous_motivation_within,timepoint_num1)                              1.01
## cor(Intercept,autonomous_motivation_within:timepoint_num1)                    1.00
## cor(autonomous_motivation_within,autonomous_motivation_within:timepoint_num1) 1.00
## cor(timepoint_num1,autonomous_motivation_within:timepoint_num1)               1.00
##                                                                               Bulk_ESS
## sd(Intercept)                                                                     1392
## sd(autonomous_motivation_within)                                                  1246
## sd(timepoint_num1)                                                                1608
## sd(autonomous_motivation_within:timepoint_num1)                                   1701
## cor(Intercept,autonomous_motivation_within)                                       2234
## cor(Intercept,timepoint_num1)                                                     2248
## cor(autonomous_motivation_within,timepoint_num1)                                  1000
## cor(Intercept,autonomous_motivation_within:timepoint_num1)                        5092
## cor(autonomous_motivation_within,autonomous_motivation_within:timepoint_num1)     4424
## cor(timepoint_num1,autonomous_motivation_within:timepoint_num1)                   4244
##                                                                               Tail_ESS
## sd(Intercept)                                                                     1890
## sd(autonomous_motivation_within)                                                  1523
## sd(timepoint_num1)                                                                2510
## sd(autonomous_motivation_within:timepoint_num1)                                   1888
## cor(Intercept,autonomous_motivation_within)                                       1935
## cor(Intercept,timepoint_num1)                                                     2384
## cor(autonomous_motivation_within,timepoint_num1)                                  1274
## cor(Intercept,autonomous_motivation_within:timepoint_num1)                        2677
## cor(autonomous_motivation_within,autonomous_motivation_within:timepoint_num1)     3178
## cor(timepoint_num1,autonomous_motivation_within:timepoint_num1)                   3296
## 
## Population-Level Effects: 
##                                              Estimate Est.Error l-95% CI
## Intercept                                       40.38      1.42    37.61
## timepoint_num1                                  24.22      1.43    21.33
## autonomous_motivation_between                    2.36      1.49    -0.52
## autonomous_motivation_within                     3.25      0.78     1.74
## timepoint_num1:autonomous_motivation_between    -0.28      1.51    -3.21
## timepoint_num1:autonomous_motivation_within     -1.69      0.99    -3.58
##                                              u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept                                       43.14 1.00     1603     2539
## timepoint_num1                                  26.99 1.00     2515     2934
## autonomous_motivation_between                    5.28 1.00     1440     2077
## autonomous_motivation_within                     4.78 1.00     3734     3068
## timepoint_num1:autonomous_motivation_between     2.62 1.00     2026     2955
## timepoint_num1:autonomous_motivation_within      0.23 1.00     5674     3394
## 
## Family Specific Parameters: 
##       Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma    22.03      0.40    21.29    22.83 1.00     2416     2923
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Plot Conditional Effects of Within Person Differences * time (H1)

####Plotting conditional effects#######################3####

#between * time
predicted = ggeffects::ggpredict(mod_h1, c("autonomous_motivation_between [-1, 0, 1]", "timepoint_num"))  %>%
  data.frame() %>%
  mutate(x = ifelse(x == -1, "-1 SD",
                    ifelse(x == 0, "Mean",
                           ifelse(x == 1, "+1 SD","nothing"))),
         x = factor(x, levels = c("-1 SD", "Mean", "+1 SD")),
         group = recode(group, "0" = "Start", "1" = "Finish"),
         group = factor(group, levels = c("Start", "Finish")))

predicted %>%
  ggplot(aes(group, predicted, color = x, group = x)) +
  geom_pointrange(aes(ymin = conf.low, ymax = conf.high), position = position_dodge(0.05), size = 1.5) +
  geom_line(position = position_dodge(0.05), size = 1.5) +
  scale_color_manual(name = "Motivation", values = palette_condition) +
  scale_x_discrete(expand = c(.1, .1)) +
  coord_cartesian(ylim = c(35, 70)) +
  labs(y = "Goal progress\n", x = "Timepoint") +
  theme(axis.text=element_text(size=30),
        axis.title=element_text(size=30,face="bold"),
        legend.text = element_text(size = 30,face = "bold"),
        legend.title = element_text(size = 20,face = "bold")) +
  theme(legend.position = "right") + 
  theme(axis.text.x = , axis.ticks.x = , axis.text.y = , axis.ticks.y = )

Plot our Posteriors Between-person differences in autonomous motivation (H1)

h_posterior <- as.matrix(mod_h1)

h1_plots <- mcmc_areas(h_posterior,
           pars = c("b_autonomous_motivation_between", 
                    "b_timepoint_num1:autonomous_motivation_between" ),
           prob = 0.95, point_est = "median")


h1_plots <- h1_plots + labs(x = "Value", y = 'Parameter')+  theme(axis.text=element_text(size=16),
                                                   axis.title=element_text(size=20,face="bold")) +
  ggplot2::scale_y_discrete(labels = c("Autonomous Motivation Between", "Autonomous Motivation Between * Time"))

annotate_figure(h1_plots,
                top = text_grob("Between Person Posterior distributions",  color = "black", face = "bold", size = 20),
                bottom = text_grob("Note. Estimates presented are medians within the 95% Credible Intervals."
                                   , color = "Black",
                                   hjust = 1.1, x = 1, face = "italic", size = 16))

h_posteriors <- get_parameters(mod_h1)
bayestestR::hdi(h_posteriors$b_autonomous_motivation_within)

Look at Influence of Priors

hplot1 <- plot(hypothesis(mod_h1, "autonomous_motivation_between > 0")) #shows how influential our priors were on our posteriors

hplot2 <- plot(hypothesis(mod_h1,"timepoint_num1:autonomous_motivation_between > 0")) #shows how influential our priors were on our posteriors

Hypothesis 2

H2 Within-person: Goals that are more autonomous compared to a person’s average will be associated with greater progress

Results

✅ These data are consistent with our second hypothesis as participants who pursued goals that were more autonomous compared to a person’s average reported greater progress.

Plot Conditional Effects of Within Person Differences * time

predicted = ggeffects::ggpredict(mod_h1, c("autonomous_motivation_within [-1, 0, 1]", "timepoint_num"))  %>%
  data.frame() %>%
  mutate(x = ifelse(x == -1, "-1 SD",
                    ifelse(x == 0, "Mean",
                           ifelse(x == 1, "+1 SD","nothing"))),
         x = factor(x, levels = c("-1 SD", "Mean", "+1 SD")),
         group = recode(group, "0" = "Start", "1" = "Finish"),
         group = factor(group, levels = c("Start", "Finish")))

predicted %>%
  ggplot(aes(group, predicted, color = x, group = x)) +
  geom_pointrange(aes(ymin = conf.low, ymax = conf.high), position = position_dodge(0.05), size = 1.5) +
  geom_line(position = position_dodge(0.05), size = 1.5) +
  scale_color_manual(name = "Motivation", values = palette_condition) +
  scale_x_discrete(expand = c(.1, .1)) +
  coord_cartesian(ylim = c(35, 70)) +
  labs(y = "Goal progress\n", x = "Timepoint") +
  theme(axis.text=element_text(size=30),
        axis.title=element_text(size=30,face="bold"),
        legend.text = element_text(size = 30,face = "bold"),
        legend.title = element_text(size = 20,face = "bold")) +
  theme(legend.position = "right") + 
  theme(axis.text.x = , axis.ticks.x = , axis.text.y = , axis.ticks.y = ) 

Plot our Posteriors for H2

#main effect of autonomous(within)
#Plot posteror 
h2_plots <- mcmc_areas(h_posterior,
                       pars = c("b_autonomous_motivation_within", 
                                "b_timepoint_num1:autonomous_motivation_within",
                                "sd_SID__autonomous_motivation_within",
                                "sd_SID__autonomous_motivation_within:timepoint_num1" ),
                       prob = 0.95, point_est = "median") 

h2_plots <- h2_plots + labs(x = "Value", y = 'Parameter')+  theme(axis.text=element_text(size=16),
                                                                  axis.title=element_text(size=16,face="bold")) +
  ggplot2::scale_y_discrete(labels = c("Autonomous Motivation Within", "Autonomous Motivation Within * Time", 
                                       "Autonomous Motivation Within (Random Effects)", ("Autonomous Motivation Within * Time (Random Effects)")))

annotate_figure(h2_plots,
                top = text_grob("Within-Person Posterior Distributions ",  color = "black", face = "bold", size = 16),
                bottom = text_grob("Note. Estimates presented are medians within the 95% Credible Intervals."
                                   , color = "Black",
                                   hjust = 2.2, x = 1, face = "italic", size = 16))

Look at Infuence of Priors

hplot3 <- plot(hypothesis(mod_h1,"autonomous_motivation_within > 0")) #shows how influential our priors were on our posteriors

hplot4 <- plot(hypothesis(mod_h1,"timepoint_num1:autonomous_motivation_within > 0")) #shows how influential our priors were on our posteriors

Exploratory analyses

We will estimate a single model to test E1 and E2. The coefficient that will be interpreted is highlighted for each research question below.

Exploratory Question 1

E1 Between-person : Do people who tend to have more controlled goals compared to others more or less successful at pursuing their goals?

####Exploratory###############################################
e1_prior <- c(set_prior("normal(0, 5)", class = "b"),
              set_prior("normal(0, 5)", class = "Intercept")) #set our weakly informative prior 


#run model
mod_e1 <- brm(progress ~ timepoint_num + controlled_motivation_between + controlled_motivation_between * timepoint_num + controlled_motivation_within +
                controlled_motivation_within * timepoint_num + (1 + controlled_motivation_within * timepoint_num | SID),
              prior  =  e1_prior, data = data, sample_prior = TRUE)

Results E1

❌ These data show zero effects for the interaction of between-person differences in autonomous motivation * time, as well as the main effect of between-person differences in autonomous motivation,

Look at our model.

mod_e1
##  Family: gaussian 
##   Links: mu = identity; sigma = identity 
## Formula: progress ~ timepoint_num + controlled_motivation_between + controlled_motivation_between * timepoint_num + controlled_motivation_within + controlled_motivation_within * timepoint_num + (1 + controlled_motivation_within * timepoint_num | SID) 
##    Data: data (Number of observations: 2068) 
##   Draws: 4 chains, each with iter = 2000; warmup = 1000; thin = 1;
##          total post-warmup draws = 4000
## 
## Group-Level Effects: 
## ~SID (Number of levels: 181) 
##                                                                               Estimate
## sd(Intercept)                                                                    17.92
## sd(controlled_motivation_within)                                                  4.35
## sd(timepoint_num1)                                                               14.62
## sd(controlled_motivation_within:timepoint_num1)                                   2.31
## cor(Intercept,controlled_motivation_within)                                      -0.12
## cor(Intercept,timepoint_num1)                                                    -0.81
## cor(controlled_motivation_within,timepoint_num1)                                 -0.01
## cor(Intercept,controlled_motivation_within:timepoint_num1)                       -0.42
## cor(controlled_motivation_within,controlled_motivation_within:timepoint_num1)    -0.02
## cor(timepoint_num1,controlled_motivation_within:timepoint_num1)                   0.31
##                                                                               Est.Error
## sd(Intercept)                                                                      1.24
## sd(controlled_motivation_within)                                                   1.16
## sd(timepoint_num1)                                                                 1.41
## sd(controlled_motivation_within:timepoint_num1)                                    1.40
## cor(Intercept,controlled_motivation_within)                                        0.19
## cor(Intercept,timepoint_num1)                                                      0.05
## cor(controlled_motivation_within,timepoint_num1)                                   0.21
## cor(Intercept,controlled_motivation_within:timepoint_num1)                         0.34
## cor(controlled_motivation_within,controlled_motivation_within:timepoint_num1)      0.40
## cor(timepoint_num1,controlled_motivation_within:timepoint_num1)                    0.36
##                                                                               l-95% CI
## sd(Intercept)                                                                    15.64
## sd(controlled_motivation_within)                                                  1.71
## sd(timepoint_num1)                                                               11.94
## sd(controlled_motivation_within:timepoint_num1)                                   0.15
## cor(Intercept,controlled_motivation_within)                                      -0.50
## cor(Intercept,timepoint_num1)                                                    -0.89
## cor(controlled_motivation_within,timepoint_num1)                                 -0.42
## cor(Intercept,controlled_motivation_within:timepoint_num1)                       -0.91
## cor(controlled_motivation_within,controlled_motivation_within:timepoint_num1)    -0.74
## cor(timepoint_num1,controlled_motivation_within:timepoint_num1)                  -0.53
##                                                                               u-95% CI
## sd(Intercept)                                                                    20.46
## sd(controlled_motivation_within)                                                  6.38
## sd(timepoint_num1)                                                               17.62
## sd(controlled_motivation_within:timepoint_num1)                                   5.24
## cor(Intercept,controlled_motivation_within)                                       0.26
## cor(Intercept,timepoint_num1)                                                    -0.71
## cor(controlled_motivation_within,timepoint_num1)                                  0.40
## cor(Intercept,controlled_motivation_within:timepoint_num1)                        0.45
## cor(controlled_motivation_within,controlled_motivation_within:timepoint_num1)     0.76
## cor(timepoint_num1,controlled_motivation_within:timepoint_num1)                   0.88
##                                                                               Rhat
## sd(Intercept)                                                                 1.00
## sd(controlled_motivation_within)                                              1.00
## sd(timepoint_num1)                                                            1.00
## sd(controlled_motivation_within:timepoint_num1)                               1.00
## cor(Intercept,controlled_motivation_within)                                   1.00
## cor(Intercept,timepoint_num1)                                                 1.00
## cor(controlled_motivation_within,timepoint_num1)                              1.00
## cor(Intercept,controlled_motivation_within:timepoint_num1)                    1.00
## cor(controlled_motivation_within,controlled_motivation_within:timepoint_num1) 1.00
## cor(timepoint_num1,controlled_motivation_within:timepoint_num1)               1.00
##                                                                               Bulk_ESS
## sd(Intercept)                                                                     1213
## sd(controlled_motivation_within)                                                   949
## sd(timepoint_num1)                                                                1524
## sd(controlled_motivation_within:timepoint_num1)                                   1268
## cor(Intercept,controlled_motivation_within)                                       2816
## cor(Intercept,timepoint_num1)                                                     2214
## cor(controlled_motivation_within,timepoint_num1)                                  1195
## cor(Intercept,controlled_motivation_within:timepoint_num1)                        3741
## cor(controlled_motivation_within,controlled_motivation_within:timepoint_num1)     3356
## cor(timepoint_num1,controlled_motivation_within:timepoint_num1)                   2868
##                                                                               Tail_ESS
## sd(Intercept)                                                                     2241
## sd(controlled_motivation_within)                                                   640
## sd(timepoint_num1)                                                                2324
## sd(controlled_motivation_within:timepoint_num1)                                   1998
## cor(Intercept,controlled_motivation_within)                                       2180
## cor(Intercept,timepoint_num1)                                                     2891
## cor(controlled_motivation_within,timepoint_num1)                                  1570
## cor(Intercept,controlled_motivation_within:timepoint_num1)                        3161
## cor(controlled_motivation_within,controlled_motivation_within:timepoint_num1)     3019
## cor(timepoint_num1,controlled_motivation_within:timepoint_num1)                   3080
## 
## Population-Level Effects: 
##                                              Estimate Est.Error l-95% CI
## Intercept                                       40.47      1.47    37.48
## timepoint_num1                                  24.08      1.42    21.27
## controlled_motivation_between                   -0.92      1.50    -3.88
## controlled_motivation_within                    -0.95      0.79    -2.53
## timepoint_num1:controlled_motivation_between     0.93      1.49    -2.04
## timepoint_num1:controlled_motivation_within      2.92      1.02     0.92
##                                              u-95% CI Rhat Bulk_ESS Tail_ESS
## Intercept                                       43.36 1.00     1308     2394
## timepoint_num1                                  26.81 1.00     2077     3056
## controlled_motivation_between                    2.01 1.00     1471     2222
## controlled_motivation_within                     0.55 1.00     3980     3450
## timepoint_num1:controlled_motivation_between     3.91 1.00     2365     2827
## timepoint_num1:controlled_motivation_within      4.91 1.00     4833     3153
## 
## Family Specific Parameters: 
##       Estimate Est.Error l-95% CI u-95% CI Rhat Bulk_ESS Tail_ESS
## sigma    22.19      0.40    21.46    22.99 1.00     2275     2375
## 
## Draws were sampled using sampling(NUTS). For each parameter, Bulk_ESS
## and Tail_ESS are effective sample size measures, and Rhat is the potential
## scale reduction factor on split chains (at convergence, Rhat = 1).

Plot conditional effects of Between Person Controlled Motivation * Time

###Conditional effects#############################

#between person controlled 

predicted = ggeffects::ggpredict(mod_e1, c("controlled_motivation_between [-1, 0, 1]", "timepoint_num"))  %>%
  data.frame() %>%
  mutate(x = ifelse(x == -1, "-1 SD",
                    ifelse(x == 0, "Mean",
                           ifelse(x == 1, "+1 SD","nothing"))),
         x = factor(x, levels = c("-1 SD", "Mean", "+1 SD")),
         group = recode(group, "0" = "check-in", "1" = "follow-up"),
         group = factor(group, levels = c("check-in", "follow-up")))

predicted %>%
  ggplot(aes(group, predicted, color = x, group = x)) +
  geom_pointrange(aes(ymin = conf.low, ymax = conf.high), position = position_dodge(0.05), size = 1.5) +
  geom_line(position = position_dodge(0.05), size = 1.5) +
  scale_color_manual(name = "Motivation", values = palette_condition) +
  scale_x_discrete(expand = c(.1, .1)) +
  coord_cartesian(ylim = c(35, 70)) +
  labs(y = "Goal progress\n", x = "Timepoint") +
  theme(axis.text=element_text(size=30),
        axis.title=element_text(size=30,face="bold"),
        legend.text = element_text(size = 30,face = "bold"),
        legend.title = element_text(size = 20,face = "bold")) +
  theme(legend.position = "right") + 
  theme(axis.text.x = , axis.ticks.x = , axis.text.y = , axis.ticks.y = )

Plot Posterior for Between Person Differences in Controlled Motivation (E1)

#E1 Hypothesis
#Plot posteriors 
#build matrix to build graphs
e_posterior <- as.matrix(mod_e1)

e1_plots <- mcmc_areas(e_posterior,
                       pars = c("b_controlled_motivation_between", 
                                "b_timepoint_num1:controlled_motivation_between" ),
                       prob = 0.95, point_est = "median")


e1_plots <- e1_plots + labs(x = "Value", y = 'Parameter')+  theme(axis.text=element_text(size=16),
                                                                  axis.title=element_text(size=16,face="bold")) +
  ggplot2::scale_y_discrete(labels = c("Controlled Motivation Between", "Controlled Motivation Between * Time"))

annotate_figure(e1_plots,
                top = text_grob("Between Person Posterior distributions",  color = "black", face = "bold", size = 16),
                bottom = text_grob("Note. Estimates presented are medians within the 95% Credible Intervals."
                                   , color = "Black",
                                   hjust = 1.1, x = 1, face = "italic", size = 16))

Exploratory Hypothesis 2

E2 Within-person: Do goals that are more controlled compared to a person’s average lead to higher or lower success?

Results E2

These results showed no main effect of within-person differences in controlled motivation. However, there was a non-zero interaction effect between within-person differences in controlled motivation and time. Specifically, goals that were more controlled compared to a person’s average led to higher success at the follow-up timepoint, whereas goals that were les controlled compared to a person’s average led to higher goal progress at the check-in timepoint.

Plot conditional effects of Within-Person Controlled Motivation * Time (E2)

###Plotting controlled within 
predicted = ggeffects::ggpredict(mod_e1, c("controlled_motivation_within [-1, 0, 1]", "timepoint_num"))  %>%
  data.frame() %>%
  mutate(x = ifelse(x == -1, "-1 SD",
                    ifelse(x == 0, "Mean",
                           ifelse(x == 1, "+1 SD","nothing"))),
         x = factor(x, levels = c("-1 SD", "Mean", "+1 SD")),
         group = recode(group, "0" = "check-in", "1" = "follow-up"),
         group = factor(group, levels = c("check-in", "follow-up")))

predicted %>%
  ggplot(aes(group, predicted, color = x, group = x)) +
  geom_pointrange(aes(ymin = conf.low, ymax = conf.high), position = position_dodge(0.05), size = 1.5) +
  geom_line(position = position_dodge(0.05), size = 1.5) +
  scale_color_manual(name = "Motivation", values = palette_condition) +
  scale_x_discrete(expand = c(.1, .1)) +
  coord_cartesian(ylim = c(35, 70)) +
  labs(y = "Goal progress\n", x = "Timepoint") +
  theme(axis.text=element_text(size=30),
        axis.title=element_text(size=30,face="bold"),
        legend.text = element_text(size = 30,face = "bold"),
        legend.title = element_text(size = 20,face = "bold")) +
  theme(legend.position = "right") + 
  theme(axis.text.x = , axis.ticks.x = , axis.text.y = , axis.ticks.y = )

Plot Posteriors for Within-Person Differences in Controlled Motivation (E2)

e2_plots <- mcmc_areas(e_posterior,
                       pars = c("b_controlled_motivation_within", 
                                "b_timepoint_num1:controlled_motivation_within",
                                "sd_SID__controlled_motivation_within",
                                "sd_SID__controlled_motivation_within:timepoint_num1" ),
                       prob = 0.95, point_est = "median") 


e2_plots <- e2_plots + labs(x = "Value", y = 'Parameter')+  theme(axis.text=element_text(size=16),
                                                                  axis.title=element_text(size=16,face="bold")) +
  ggplot2::scale_y_discrete(labels = c("Controlled Motivation Within", "Controlled Motivation Within * Time", 
                                       "Controlled Motivation Within (Random Effects)", ("Controlled Motivation Within * Time (Random Effects)")))

annotate_figure(e2_plots,
                top = text_grob("Within-Person Posterior Distributions ",  color = "black", face = "bold", size = 16),
                bottom = text_grob("Note. Estimates presented are medians within the 95% Credible Intervals."
                                   , color = "Black",
                                   hjust = 2.2, x = 1, face = "italic", size = 16))

Individual-level analyses

data <- read_csv("disaggregated_data.csv") %>%
  mutate(`autonomous motivation (between)` = ifelse(autonomous_motivation_between > 0, "high", "low"),
         `autonomous motivation (within)` = ifelse(autonomous_motivation_within > 0, "high", "low"),
         timepoint = recode(timepoint, "Check In" = "Start", "Follow Up" = "Finish"),
         timepoint = factor(timepoint, levels = c("Start", "Finish"))) %>%
  select(SID, wave, timepoint, goal_number, progress, contains("("))

visualize data

within-person

data %>%
  filter(!is.na(`autonomous motivation (within)`)) %>%
  ggplot(aes(timepoint, progress, color = `autonomous motivation (within)`)) +
  geom_line(aes(group = interaction(SID, goal_number, wave)), alpha = .1) +
  plot_aes +
  guides(colour = guide_legend(override.aes = list(alpha = 1))) +
  scale_x_discrete(expand = c(.1, .1)) +
    theme(axis.text=element_text(size=30),
        axis.title=element_text(size=30,face="bold"),
        legend.text = element_text(size = 30,face = "bold"),
        legend.title = element_text(size = 20,face = "bold"))

between-person

data %>%
  filter(!is.na(`autonomous motivation (between)`)) %>%
  group_by(SID, timepoint, `autonomous motivation (between)`) %>%
dplyr::summarize(`mean progress` = mean(progress, na.rm = TRUE)) %>%
  ggplot(aes(timepoint, `mean progress`, color = `autonomous motivation (between)`)) +
  geom_line(aes(group = interaction(SID)), alpha = .5) +
  plot_aes +
  guides(colour = guide_legend(override.aes = list(alpha = 1))) +
  scale_x_discrete(expand = c(.1, .1)) +
  theme(axis.text=element_text(size=30),
        axis.title=element_text(size=30,face="bold"),
        legend.text = element_text(size = 30,face = "bold"),
        legend.title = element_text(size = 20,face = "bold"))